<template>
  <el-table :data="tableData" style="width: 100%">
    <el-table-column label="序号" width="180">
      <template #default="scope">
        <div style="display: flex; align-items: center">
          <el-icon>
            <timer />
          </el-icon>
          <span style="margin-left: 10px">{{ scope.row.id }}</span>
        </div>
      </template>
    </el-table-column>
    <el-table-column label="名字" width="180">
      <template #default="scope">
        <div style="display: flex; align-items: center">
          <el-icon>
            <timer />
          </el-icon>
          <span style="margin-left: 10px">{{ scope.row.drugName }}</span>
        </div>
      </template>
    </el-table-column>
    <el-table-column label="来源" width="180">
      <template #default="scope">
        <div style="display: flex; align-items: center">
          <el-icon>
            <timer />
          </el-icon>
          <span style="margin-left: 10px">{{ scope.row.durgSource }}</span>
        </div>
      </template>
    </el-table-column>
    <el-table-column label="操作">
      <template #default="scope">
        <el-button size="small" @click="dialogVisible = true">编辑</el-button>
        <el-button size="small" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
      </template>
    </el-table-column>
  </el-table>

  <!-- 编辑弹窗 -->
  <el-dialog v-model="dialogVisible" title="编辑字典表" width="30%" draggable>
    <div>
      名称：<el-input></el-input>
      <el-button type="primary" round>保存</el-button>
    </div>
  </el-dialog>
</template>

<script lang="ts" setup>
import { ref  } from 'vue'
import { onBeforeMount } from 'vue';
import axios from '@/utils/http'

const dialogVisible = ref(false)

const tableData = ref('')

// 渲染表格接口
const data: any = ref("")

onBeforeMount(
  () => {

    axios({
      url: "/systemDrug/fundDrugs",
      method: "get",
      headers: {
        "Content-Type": "application/json"
      },
      data: {
      }
    })
      .then((res: any) => {
        console.log("1",res)
        // console.log("2",res.data.data)
        // console.log("3",res.data.data)
        // data.value=JSON.parse(res.data.data)
        // console.log( data.value[0].);
        
        // data.value = JSON.parse(res.data.data).data
        // console.log('data', data.value[0]);
        // tableData.value = data.value;
        // console.log('tabledata', tableData);

        // tableData=data.value

      })

  })
</script>

<style scoped></style>